import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-10-04
 * Time: 21:06
 */
public class Demo2 {
    public static void main(String[] args) throws IOException {
        try (Reader reader = new FileReader("d:/test.txt")) {
            while (true) {
                char[] cbuf = new char[3];
                //这个read方法的返回值是读取到的字符的个数
                int ret = reader.read(cbuf);
                if (ret == -1) break;
                for (int i = 0; i < ret; i++) {
                    System.out.println(cbuf[i]);
                }
            }
        }
    }
}
